package com.feige.auth.pojo;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.feige.base.po.BaseAuditorPo;
import com.feige.base.vo.BaseVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.persistence.Entity;
import javax.persistence.Table;


/**
 * @author feige
 */
@Getter
@Setter
@ToString
@Entity
@Table(name = "xf_principle")
@TableName("xf_principle")
@ApiModel("登录实体")
public class PrinciplePo extends BaseAuditorPo {
    
    private static final long serialVersionUID = 1727060866223081128L;
    
    @ApiModelProperty(value = "登录名")
    private String loginName;

    @ApiModelProperty(value = "密码")
    @JsonIgnore
    private String password;
    
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @ApiModelProperty(value = "关联用户实体")
    private Long userId;


    @Override
    public BaseVo toVo() {
        LoginUser loginUser = new LoginUser();
        loginUser.setId(this.getId());
        loginUser.setLoginName(this.getLoginName());
        loginUser.setUserId(this.getUserId());
        return loginUser;
    }
}
